package com.fast.utils.bean;

import java.util.HashMap;

/**
 * 返回数据
 *
 * @param
 */
public class R extends HashMap<String, Object> {
    private static final long serialVersionUID = 1L;


    public  static  R ok(){
        return new R().put("code" , 200 );
    }

    public static R ok(String msg) {
        return new R().put("code", 200).put("msg", msg);
    }

    public static <T> R ok(String msg, T data) {
        return new R().put("code", 200).put("msg", msg).put("data", data);
    }

    public static <T> R error(String msg, T data) {
        return new R().put("code", 500).put("msg", msg).put("data", data);
    }


    public static R error(String msg) {
        return new R().put("code", 500).put("msg", msg);
    }


    public R put(String key, Object value) {
        super.put(key, value);
        return this;
    }


}



